package testjob;

import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import java.util.Calendar;

/**
 * Created by Administrator on 2017/1/9.
 */
@DisallowConcurrentExecution
public class MyJob implements Job {
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        System.out.println("任务正在执行，执行时间: " + Calendar.getInstance().getTime());
        try {
            Thread.sleep(11000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        try {
            throw new Exception("股市大幅");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
